$def with(partners, pager, query_key, get_media_url)
$:render.admin.header(css=['admin/css/popup.css', 'admin/css/media.css'])

<script type="text/javascript">
    var topWin = window.dialogArguments || opener || parent || top;
    $$(function() {
        $$('._selected').click(function() {
            var self = $$(this);
            var id = self.attr('partner');
            topWin.partner_selected(id, self.parent().find('.title').html());
        });
    });
</script>
<div id="media-upload-header">
	<ul id="sidemenu">
		<li id="tab-type"><a href="$config.ADMIN_DIR/partner/add?mode=lite">添加合作商家</a></li>
		<li id="tab-library"><a href="$config.ADMIN_DIR/partner?mode=lite" class="current">已有合作商家</a></li>
	</ul>
</div>

<form id="filter" action="" method="get">
<div class="tablenav">

    <div class='tablenav-pages'>
        $:pager
    </div>
<div class="alignleft actions">
<label class="screen-reader-text" for="media-search-input">搜索合作商家:</label>
	<input type="text" class="txt" id="media-search-input" name="q" value="$query_key" />
    <input type="hidden" name="mode" value="lite" />
    <input type="submit" class="btn" value="搜索商家"  />
</div>

<br class="clear" />
</div>
</form>

<div id="media-items">
    $if partners:
        $for partner in partners:
            <div id="media-item-$partner.id" class="media-item child-of-0 preloaded">
                $if partner.logo > 0:
                    <img class="pinkynail toggle" src="$get_media_url(partner.logo, 3)" alt="">
                <a href="$config.ADMIN_DIR/partner/edit/$partner.id?mode=lite" class="toggle describe-toggle-on">修改</a>
                <a class="toggle describe-toggle-on _selected" href="javascript:;" partner="$partner.id">选择</a>
                <div class="filename new"><span class="title">$partner.name</span></div>
            </div>
    $else:
        <font color="gray">尚未添加合作方</font>
</div>


$:render.admin.footer()
